extends NodeState


@export var knife: Knife


var velocity: Vector2


func _on_process(delta : float) -> void:
	process_movement(delta)



func _on_enter() -> void:
	knife.damageEmitter.set_deferred("monitoring", true)
	velocity = knife.direction * knife.speed
	knife.flip_sprite()
	knife.animationPlayer.play(Collectible.ANIMATION_FLY)


func _on_exit() -> void:
	knife.damageEmitter.set_deferred("monitoring", false)
	velocity = Vector2.ZERO


func process_movement(delta : float):
	knife.position += velocity * delta
